import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import state from './state'
import mutations from './mutations'
import createLogger from 'vuex/dist/logger' // vuex调试工具，每次会log出preValue 和 nextValue

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production' // dev时代表开发环境，production代表线上环境，代表开发环境开启严格模式，线上则关闭耗费性能的严格模式
export default new Vuex.Store({
  actions,
  getters,
  state,
  mutations,
  // strict: debug,
  plugins: debug ? [createLogger()] : []
})
